function monkeytest() {
    var seed=$('#seedinput').val();
    var apptype=$('input:radio[name="apptype"]:checked').val();
    $.ajax({
			type: "POST",
			url: "/androidtest/monkeytest/",
			contentType: "application/json",
			data: JSON.stringify({
				"seed": seed,
				"apptype": apptype
			}),
			beforeSend: function () {
				layer.load(0, {shade: [0.4, '#E8E8E8', true]});
			},
			success: function (rsp) {
				console.log(rsp);
				layer.alert('monkey测试完成！', {
					icon: 6,
					skin: 'layer-ext-moon'
                 });
			},
			complete: function () {
				layer.closeAll('loading');
            },
            error: function (data) {
				console.info("error: " + data.responseText);
            }
		})
}

function serachMonkeyResult(){
		$.ajax({
			type: "POST",
			url: "/androidtest/readMonkeyFile/",
			contentType: "application/json",
			success: function (rsp) {
				console.log(rsp);
				var data = $.parseJSON(rsp);
				var seed=data.model['seed'];
				var packageName=data.model['packageName'];
				var anr=data.model['anr'];
				var crash=data.model['crash'];
				var exception=data.model['exception'];
				var result=data.model['result'];
				$("#nodata").hide();
				var monkeyResultHtml = "<table class=\"tab1\">\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:yellow\">\n" +
					"\t\t\t\t\t\t\t<td colspan=3>被测包：" + packageName + "</td>\n" +
					"\t\t\t\t\t\t\t<td colspan=2>事件流执行：250000/250000次</td>\n" +
					"\t\t\t\t\t\t\t<td colspan=4>错误出现次数</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>事件流类型</td>\n" +
					"\t\t\t\t\t\t\t<td>事件百分比</td>\n" +
					"\t\t\t\t\t\t\t<td>Seed值</td>\n" +
					"\t\t\t\t\t\t\t<td>日志Level</td>\n" +
					"\t\t\t\t\t\t\t<td>Throttle间隔毫秒数</td>\n" +
					"\t\t\t\t\t\t\t<td colspan=4 rowspan=9><label>ANR:"+anr+"<br/>CRASH:"+crash+"<br/>Exception:"+exception+"</label></td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>触摸事件（TOUCH）</td>\n" +
					"\t\t\t\t\t\t\t<td>20%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>滑动事件（MOTION）</td>\n" +
					"\t\t\t\t\t\t\t<td>20%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>缩放事件（PINCHZOOM）</td>\n" +
					"\t\t\t\t\t\t\t<td>10%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>主要导航事件（MAJORNAV）</td>\n" +
					"\t\t\t\t\t\t\t<td>15%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>系统事件（SYSKEYS）</td>\n" +
					"\t\t\t\t\t\t\t<td>3%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>Activity启动事件（APPSWITCH）</td>\n" +
					"\t\t\t\t\t\t\t<td>20%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>键盘翻转事件（FLIP）</td>\n" +
					"\t\t\t\t\t\t\t<td>10%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#90EE90\">\n" +
					"\t\t\t\t\t\t\t<td>其它事件（ANYEVENT）</td>\n" +
					"\t\t\t\t\t\t\t<td>2%</td>\n" +
					"\t\t\t\t\t\t\t<td>" + seed + "</td>\n" +
					"\t\t\t\t\t\t\t<td>-v-v-v</td>\n" +
					"\t\t\t\t\t\t\t<td>0/200</td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t\t<tr style=\"background-color:#3CB371\">\n" +
					"\t\t\t\t\t\t\t<td colspan=9><label>测试结果："+result+"</label></td>\n" +
					"\t\t\t\t\t\t</tr>\n" +
					"\t\t\t\t\t</table>"
				$('#monkeydiv').append(monkeyResultHtml);

			}
		})

}

function fileDownload(){
	window.location="/androidtest/fileDownloadTxt/";
}